package com.iwhalecloud.bss.kite.cucc.service.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import com.iwhalecloud.bss.kite.cart.client.api.cart.operate.IOperateKiteCartService;
import com.iwhalecloud.bss.kite.cart.client.dto.req.KiteCartStatusModifyRequestDTO;
import com.iwhalecloud.bss.kite.common.util.KiteBeanUtils;
import com.iwhalecloud.bss.kite.cucc.service.even.KiteCartStatusModifyEvent;

/**
 * @author zhu
 * @since 2020/04/23
 */
@Service
public class KiteCartStatusModifyListener {

    @Autowired
    private IOperateKiteCartService operateKiteCartService;

    @EventListener
    @Order(1)
    public void modifyKiteCartStatus(KiteCartStatusModifyEvent event) {
        KiteCartStatusModifyRequestDTO request = new KiteCartStatusModifyRequestDTO();
        KiteBeanUtils.copyProperties(event, request);
        operateKiteCartService.modifyKiteCartStatus(request);
    }

}
